# coding: utf-8

"""
    不断询问用户买啥，直到用户输入q，打印用户购买了哪些商品
"""
products = [
    ["iphone", 6888],
    ["MaxPro", 14800],
    ["小米6", 2499],
    ["Coffee", 31],
    ["Book", 60],
    ["Fan", 49]
]
shoppingCart = []

print("-----商品列表-----")
for i in range(len(products)):
    print(i, products[i][0], products[i][1])

while True:
    item = input("你要买啥:")
    if item == 'q':
        break
    else:
        item = int(item)
    if 0 <= item <= 5:
        shoppingCart.append(products[item])
    else:
        print("你买了个寂寞")

print("你买了", shoppingCart)
